public class Test {
    public static int add(int num){
        int ans = 0;
        while (num > 0){
            ans += num % 10;
            num /= 10;
        }
        return ans;
    }
    public static void main(String[] args) {
        System.out.println(add(38));
    }
}
